<template>
  <view class="login-container">
    <uni-forms @submit.native.prevent="handleSubmit">
      <uni-forms-item label="用户名" name="username" required>
        <uni-easyinput v-model="form.username" placeholder="请输入内容"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="密码" name="password" required type="password">
        <uni-easyinput v-model="form.password" type="password" placeholder="请输入内容"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item>
        <uni-button type="primary" @click="handleSubmit" native-type="submit">登录</uni-button>
      </uni-forms-item>
    </uni-forms>
  </view>
</template>

<script setup>
import { ref } from 'vue';
    const form = ref({
      username: '',
      password: '',
    });
    const handleSubmit = () => {
      console.log('提交表单:', form.value);
	  uni.switchTab({
	  	url: '/pages/index/index'
	  });
      // 在这里添加你的登录逻辑，例如调用API进行验证
    };
</script>

<style scoped>
.login-container {
  padding: 20px;
}

uni-forms-item {
  margin-bottom: 15px;
}

uni-button {
  width: 100%;
}
</style>